package com.ffms.servlet;

import com.ffms.dao.ShouruDao;
import com.ffms.dao.impl.ShouruDaoImpl;
import com.ffms.entity.Shouru;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/IncomeServlet")
public class IncomeServlet extends HttpServlet {

    public void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        this.doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        ShouruDao shouruDao = new ShouruDaoImpl();
        Shouru shouru = shouruDao.getById(Integer.parseInt(id));
        req.setAttribute("shouru", shouru);
        req.getRequestDispatcher("/admin/shouruUpdate.jsp").forward(req, resp);

    }
}
